<template>
  <projects-classification-result-v1 v-if='this.canShow' :teacher-id='userName' :data-object="baseData"></projects-classification-result-v1>
</template>

<script>
import ProjectsClassificationResultV1
  from '@views/dashboard/gfxy/assessmentResult/commons/ProjectsClassificationResultV1.vue'
import { getAction } from '@api/manage'

export default {
  name: 'ProjectsClassificationResult',
  components: { ProjectsClassificationResultV1 },
  props:{
    userName: {
      type: String,
      required: true
    },
    date: {
      type: String,
      required: true
    },
    projectType:{
      type:String,
      required:true
    },
    baseData:{
      type:Object,
      required:true
    }
  },
  data(){
    return {
      items: [],
      canShow:false,
      loading: false,
    }
  },
  methods:{
    load()
    {
      this.loading = true
      let param = {userName:this.userName, date:this.date, orgCode: this.orgCode, projectId: this.projectType, classificationId:this.baseData.id}
      console.log('param' ,param)
      getAction(this.baseData.detailUrl ,param).then((res)=>{
        if(res.success){

          this.baseData.items = res.result;
          console.log(this.baseData.items);
        }else{
          this.$message.warning(res.message);
        }
      }).finally(() => {
        this.loading = false;
        this.canShow = true;
      })
    },
  },
  mounted() {
    this.load()
  }
}
</script>

<style scoped>

</style>